package cn.xi.goods.handler;


import com.changgou.entity.Result;
import com.changgou.entity.StatusCode;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.ResponseBody;


//只对Controller进行拦截,   但是间接拦截调用的方法
@ControllerAdvice   //声明此类是一个增强类
public class baseException {
    @ExceptionHandler(value = Exception.class)
    @ResponseBody
  public Result exceptionHandl(Exception e){
        e.printStackTrace();
        return new Result(false, StatusCode.ACCESSERROR,"发生错误");
    }
}
